﻿using UnityEngine;
using System.Collections;

public class CoverCol : MonoBehaviour
{
    void OnTriggerStay2D(Collider2D CollObj)
    {
        if (CollObj.gameObject.tag == "Player")
        {
            CollObj.gameObject.GetComponent<UnitStatus>().m_unitData.m_bCoverd = true;
            CollObj.gameObject.GetComponent<UnitStatus>().m_unitData.m_Cover = transform.parent.gameObject;
        }
    }

    void OnTriggerExit2D(Collider2D CollObj)
    {
        if (CollObj.gameObject.tag == "Player")
        {
            CollObj.gameObject.GetComponent<UnitStatus>().m_unitData.m_bCoverd = false;
            CollObj.gameObject.GetComponent<UnitStatus>().m_unitData.m_Cover = null;
        }
    }
    
}
